home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSAM.EXE / OPENFIVL.PRG < prev    next >
Text File  |  1993-05-04  |  4KB  |  105 lines

  1. FUNCTION OpenFiVl
  2. PARAMETER pcObj
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *
  6. * DESCRIPTION
  7. *
  8. *----------------------------------------------------------------------------
  9.   PRIVATE lOk, nCurrId, nSParen, nEParen, nLenCs, cNewVal, cPrevCs, cErrMsg,;
  10.           nId
  11.   lOk = .T.
  12.   *--------------------------------------------------------
  13.   *-- Exit back to designer if the dialog box is not active
  14.   *--------------------------------------------------------
  15.   IF TYPE( "WM_PAINT" ) <> "N"
  16.     RETURN .t.
  17.   ENDIF
  18.  
  19.   DO CASE
  20.     CASE pcObj = "CS_FILE_1"
  21.       *---------------------------------------------------------
  22.       *-- Repaint the combo's list box based on the new wildcard
  23.       *---------------------------------------------------------
  24.       IF '?' $ CS_FILE_1 .OR. '*' $ CS_FILE_1
  25.         DO TCombo WITH WM_PAINT, CB_SHOWDRO, nCurrent
  26.       ENDIF
  27.  
  28.     CASE pcObj = "CL_TYPE_1"
  29.       *---------------------------------------------------------------
  30.       *-- Check to see if the user changed the value and return if not
  31.       *---------------------------------------------------------------
  32.       IF TYPE( "sCL_TYPE_1" ) = "C" .AND. sCL_TYPE_1 = CL_TYPE_1
  33.         RELEASE sCL_TYPE_1
  34.         RETURN .t.
  35.       ENDIF
  36.  
  37.       *------------------------------------------------------
  38.       *-- Update the CS_FILE_1 field with the selected option
  39.       *------------------------------------------------------
  40.       nCurrId = GetId( "CS_FILE_1" )    && Id pointer to CS_FILE_1
  41.  
  42.       *---------------------------------------------------------------------
  43.       *-- Build the entry field value from the file spec in the selected bar
  44.       *---------------------------------------------------------------------
  45.       nSParen = AT( "(", cl_type_1 )
  46.       nEParen = AT( ")", cl_type_1 )
  47.       cNewVal = SUBSTR( cl_type_1, nSParen + 1, nEParen - nSParen - 1 )
  48.  
  49.       cPrevCs = CS_FILE_1 
  50.       CS_FILE_1 = cNewVal
  51.       nLenCS = aClkObj[ 1, 3 ] - aClkObj[ 1, 2 ] + 1
  52.       CS_FILE_1 = LEFT( CS_FILE_1 + SPACE( nLenCS ), nLenCS )
  53.  
  54.       *---------------------------------------
  55.       *-- Paint the new value into the control
  56.       *---------------------------------------
  57.       DO TEdit WITH WM_PAINT, EN_KILLFOC, nCurrId
  58.       DO TList WITH WM_PAINT, WM_DRAWITEM, nCurrId
  59.       nCS_FILE = 0
  60.  
  61.     CASE pcObj = "BT_OK"
  62.       IF "?" $ cs_file_1 .OR. "*" $ cs_file_1 .OR. "<" $ cs_file_1
  63.         *----------------------------------------------------
  64.         *-- Set the not ok to exit flag and display a message
  65.         *----------------------------------------------------
  66.         nMess = 0                       && Reset value from DLN_OK to stay in
  67.  
  68.         lOk = .F.
  69.         nId = GetId( "BT_OK" )
  70.         cErrMsg = aClkObj[ aObjPoint[ nId ], 13 ]
  71.         DO _Err_Box WITH cErrMsg
  72.  
  73.         *---------------------------------------------------------------------
  74.         *-- Force the display of the OK button back to the default look.
  75.         *-- Because we designed this for to have the OK button as the default,
  76.         *-- we know that the OK button is at position nDlgDef.
  77.         *---------------------------------------------------------------------
  78.         DO TButton WITH WM_PAINT, BN_DEFAULT, nDlgDef
  79.  
  80.         *-------------------------------------------------------------
  81.         *-- Go back to the control where the exit attempt occurred and 
  82.         *-- unhighlight the control and its label.
  83.         *-------------------------------------------------------------
  84.         IF LEFT( aClkObj[ aObjPoint[ nCurrent ], 11 ], 3 ) $ "RB_,CK_"
  85.           DO TButton WITH WM_PAINT, BN_UNHILITE, nCurrent
  86.         ELSE
  87.           DO HasTitle WITH nCurrent, BN_UNHILITE
  88.         ENDIF
  89.  
  90.         *----------------------------------------------------------------
  91.         *-- Finally, position back to the CS_FILE_1 field and setup the
  92.         *-- nCurrent and nCurrGrp values to have GETMESS set focus on it.
  93.         *----------------------------------------------------------------
  94.         nId = GetId( "CS_FILE_1" )
  95.         nCurrent = nId
  96.         nCurrGrp = aClkObj[ aObjPoint[ nId ], 5 ]
  97.         DO HasTitle WITH nCurrent, BN_HILITE
  98.  
  99.       ENDIF
  100.  
  101.   ENDCASE
  102.  
  103. RETURN( lOk )
  104. *-- EOF: OpenFiVl()
  105.